﻿// 
// 
// Solution: DeliveryPlus
// Project: DeliveryPlus.Web
// File: Cafe.cs
// 
// Created by: ykors_000 at 08.01.2014 13:02
// 
// Property of SoftGears
// 
// ========

using System;
using System.Collections.Generic;
using System.Linq;
using DeliveryPlus.Web.Classes.Enums;

namespace DeliveryPlus.Web.DAL.Entities
{
    /// <summary>
    /// Заведение в системе
    /// </summary>
    public partial class Cafe
    {
        /// <summary>
        /// Возвращает массив доступных типов блюд
        /// </summary>
        /// <returns></returns>
        public IEnumerable<int> GetAvailableTypes()
        {
            var list = new List<int>();
            foreach (var types in Dishes.Select(dish => (dish.Types ?? "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(c => Convert.ToInt32(c)).ToList()))
            {
                list.AddRange(types);
            }
            return list.ToArray();
        }
    }
}